home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 8 / Night Owl CD-ROM (NOPV8) (Night Owl Publisher) (1993).ISO / 034a / ad_d091.arj / MASSAGE.BAS < prev    next >
BASIC Source File  |  1987-07-15  |  4KB  |  87 lines

  1. 10 REM  MASSAGE - Reads the Class and Race .PRN files, and converts them
  2. 11 REM into the format required by the AD&D Character Generator program.
  3. 12 REM
  4. 13 REM  Written  6-Jul-1987  by Monte Ferguson,   version 1.0
  5. 14 REM
  6. 20 DEF FNS$(N)=MID$(STR$(N),VAL(MID$("122",SGN(N)+2,1)))
  7. 30 DEF FNZPAD$(L,N)=STRING$(L-LEN(FNS$(N)),"0")+FNS$(N)
  8. 40 DIM F$(100),T$(100)
  9. 100 CLS:COLOR 7,0:KEY OFF
  10. 110 PRINT " MASSAGE":PRINT
  11. 120 PRINT " This program will convert the .PRN files from the Lotus 1-2-3 worksheets "
  12. 130 PRINT "into the file format required by the AD&D Character Generator program."
  13. 140 PRINT
  14. 150 PRINT " I will assume the source filenames of RACE.PRN and CLASS.PRN, and the target"
  15. 160 PRINT "filenames of RACE.DAT and CLASS.DAT. You must tell me the source and target"
  16. 170 PRINT "file paths. Omit file names!"
  17. 180 PRINT
  18. 200 INPUT " Enter Source Filepath (Example: A:\)";SOURCE$
  19. 210 IF SOURCE$="" THEN PRINT "Program ends.":END
  20. 220 INPUT " Enter Target Filepath (Example: C:\D&D\)";TARGET$
  21. 230 IF TARGET$="" THEN PRINT "Program ends.":END
  22. 300 CLS
  23. 310 PRINT TAB(10);"I will read from:";TAB(50);"and write to:"
  24. 320 PRINT TAB(10);STRING$(20,"-");TAB(50);STRING$(20,"-")
  25. 330 PRINT TAB(10);SOURCE$+"RACE.PRN";TAB(50);TARGET$+"RACE.DAT"
  26. 340 PRINT TAB(10);SOURCE$+"CLASS.PRN";TAB(50);TARGET$+"CLASS.DAT"
  27. 350 PRINT:PRINT:PRINT
  28. 360 INPUT "Is this correct (Y/N)";YN$
  29. 370 IF YN$="y" OR YN$="Y" THEN 400 ELSE IF YN$="n" OR YN$="N" THEN 100 ELSE BEEP:GOTO 300
  30. 400 REM Let's do RACE first
  31. 410 CLS
  32. 420 PRINT "Opening "+SOURCE$+"RACE.PRN...";
  33. 430 OPEN SOURCE$+"RACE.PRN" FOR INPUT AS #1:PRINT "Open."
  34. 440 PRINT "Opening "+TARGET$+"RACE.DAT...";
  35. 450 OPEN "r",#2,TARGET$+"RACE.DAT",256:PRINT "Open."
  36. 500 REC=0:F=0
  37. 510 DATA 20,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,50,1,1,3,3,3,3,3,30,61,-1
  38. 520 RESTORE 510:DUMMY=0
  39. 530 READ A:IF A<>-1 THEN F=F+1:FIELD #2,DUMMY AS DUMMY$,A AS F$(F):DUMMY=DUMMY+A:GOTO 530
  40. 540 FOR I=1 TO 5:LINE INPUT #1,DUMMY$:NEXT I:REM Tear off the header
  41. 550 PRINT "Writing records: ";
  42. 600 WHILE NOT EOF(1)
  43. 605     LINE INPUT #1,A$
  44. 610     T$(1)=MID$(A$,4,20):T$(2)=MID$(A$,24,3)
  45. 615     P=29:T$="":F=2
  46. 620     M$=MID$(A$,P,1)
  47. 625     IF M$=" " THEN IF T$<>"" THEN F=F+1:T$(F)=T$:T$="" ELSE 630 ELSE T$=T$+M$
  48. 630     P=P+1:IF P<=LEN(A$) THEN 620
  49. 635     IF T$<>"" THEN F=F+1:T$(F)=T$
  50. 640     IF F<>68 THEN BEEP:PRINT SOURCE$+"RACE.PRN is corrupt!":STOP
  51. 645     Q$="":FOR I=33 TO 60:Q$=Q$+T$(I):NEXT I:Q$=Q$+STRING$(30,"?")
  52. 650     T$(33)=Q$:FOR I=34 TO 41:T$(I)=T$(I+27):NEXT I:T$(42)=""
  53. 655     FOR I=1 TO 42:LSET F$(I)=T$(I):NEXT I
  54. 660     REC=REC+1:PUT #2,REC:PRINT REC;
  55. 665 WEND
  56. 670 CLOSE #1:CLOSE #2
  57. 680 PRINT:PRINT "RACE conversion complete.":PRINT:PRINT
  58. 700 REM Now we'll do CLASS
  59. 710 PRINT "Opening "+SOURCE$+"CLASS.PRN...";
  60. 715 OPEN SOURCE$+"CLASS.PRN" FOR INPUT AS #1:PRINT "Open."
  61. 720 PRINT "Opening "+TARGET$+"CLASS.DAT...";
  62. 725 OPEN "r",#2,TARGET$+"CLASS.DAT",256:PRINT "Open."
  63. 730 REC=0:F=0
  64. 735 DATA 15,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,1,1,50,1,128,-1
  65. 740 RESTORE 735:DUMMY=0
  66. 745 READ A:IF A<>-1 THEN F=F+1:FIELD #2,DUMMY AS DUMMY$,A AS F$(F):DUMMY=DUMMY+A:GOTO 745
  67. 750 FOR I=1 TO 5:LINE INPUT #1,DUMMY$:NEXT I:REM Tear off the header
  68. 755 PRINT "Writing records: ";
  69. 760 WHILE NOT EOF(1)
  70. 765     LINE INPUT #1,A$
  71. 770     T$(1)=MID$(A$,4,15):T$(2)=MID$(A$,19,3)
  72. 775     P=24:T$="":F=2
  73. 780     M$=MID$(A$,P,1)
  74. 785     IF M$=" " THEN IF T$<>"" THEN F=F+1:T$(F)=T$:T$="" ELSE 790 ELSE T$=T$+M$
  75. 790     P=P+1:IF P<=LEN(A$) THEN 780
  76. 795     IF T$<>"" THEN F=F+1:T$(F)=T$
  77. 800     IF F<>67 THEN BEEP:PRINT SOURCE$+"CLASS.PRN is corrupt!":STOP
  78. 805     Q$="":FOR I=39 TO 66:Q$=Q$+T$(I):NEXT I:Q$=Q$+STRING$(22,"?")
  79. 810     T$(39)=Q$:T$(40)=T$(67):T$(41)=""
  80. 815     FOR I=1 TO 41:LSET F$(I)=T$(I):NEXT I
  81. 820     REC=REC+1:PUT #2,REC:PRINT REC;
  82. 825 WEND
  83. 830 CLOSE #1:CLOSE #2
  84. 835 PRINT:PRINT "CLASS conversion complete.":PRINT:PRINT
  85. 900 PRINT "All Done!"
  86. 999 END
  87.